import request from '@/utils/request'

// 查询设备备品备件列表
export function listPart(query) {
  return request({
    url: '/equipment/part/list',
    method: 'get',
    params: query
  })
}

// 查询设备备品备件详细
export function getPart(sparePartId) {
  return request({
    url: '/equipment/part/' + sparePartId,
    method: 'get'
  })
}

export function getBindSparePart(eqpId) {
  return request({
    url: '/equipment/part/bindSparePart/' + eqpId,
    method: 'get'
  })
}

// 新增设备备品备件
export function addPart(data) {
  return request({
    url: '/equipment/part',
    method: 'post',
    data: data
  })
}

// 新增关联设备备品备件
export function addEquipPart(data) {
  return request({
    url: '/equipment/part/addEquipPart',
    method: 'post',
    data: data
  })
}

// 修改设备备品备件
export function updatePart(data) {
  return request({
    url: '/equipment/part',
    method: 'put',
    data: data
  })
}

// 删除设备备品备件
export function delPart(sparePartId) {
  return request({
    url: '/equipment/part/' + sparePartId,
    method: 'delete'
  })
}

// 删除设备备品备件
export function delEquipPart(data) {
  return request({
    url: '/equipment/part/removeEquipPart',
    method: 'delete',
    data: data
  })
}
